<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_custcomment.*" %>
<%@page import="com.lmpop.trade.ti_goods.*" %>

<%@page import="java.util.*" %>
<%@page import="com.lmpop.frame.util.PageTools" %>
<%
	request.setCharacterEncoding("UTF-8");
	 
	Map ti_custcomment = new Hashtable();
	
	ti_custcomment.put("user_id",_user_id);
	
	ti_custcomment.put("com_type","0");
	String s_cust_name = "";
	if(request.getParameter("search_cust_name")!=null && !request.getParameter("search_cust_name").equals("")){
		s_cust_name = request.getParameter("search_cust_name");
		ti_custcomment.put("cust_name",s_cust_name);
	}
	String s_StartDate="",s_EndDate="";
	
	if(request.getParameter("search_StartDate")!=null && !request.getParameter("search_StartDate").equals("")){
		s_StartDate = request.getParameter("search_StartDate");
		ti_custcomment.put("start_date",s_StartDate);
	}
	
	if(request.getParameter("search_EndDate")!=null && !request.getParameter("search_EndDate").equals("")){
		s_EndDate = request.getParameter("search_EndDate");
		ti_custcomment.put("end_date",s_EndDate);
	}
	
	Ti_custcommentInfo ti_custcommentInfo = new Ti_custcommentInfo();
	String iStart = "0";
	int limit = 20;
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	List list = ti_custcommentInfo.getListByPage(ti_custcomment,Integer.parseInt(iStart),limit);
	int counter = ti_custcommentInfo.getCountByObj(ti_custcomment);
	String pageString = new PageTools().getGoogleToolsBar(counter,"index.jsp?search_cust_name="+s_cust_name+"&search_EndDate="+s_EndDate+"&search_StartDate="+s_StartDate+"&iStart=",Integer.parseInt(iStart),limit);
	
	Ti_goodsInfo custInfo = new Ti_goodsInfo();
%>
	<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
	<script language="javascript" type="text/javascript" src="commen.js"></script>
	
	<div class="f-right">
    <table width="100%" border="0" cellspacing="0" cellpadding="0"  >
      <tr>
        <td><table width="100%"  cellpadding="0" cellspacing="0" class="table_main">
            <tr>
              <th width="5%" height="40" align="center"><img src="/program/member/index/images/icon1.gif"></th>
              <th width="75%"><h3>商品评价</h3></th>
              <th width="20%"> </th>
            </tr>
          </table>
		  
		  
		  	<form action="index.jsp" name="indexForm" method="post">
          <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ts">
            <tr>
              <td height="45" align="left">商品名称:
                <input type="text" class="input" name = "search_cust_name" id= "search_cust_name" maxlength="50" onBlur="this.value=ignoreSpaces(this.value);">

		按评价时间:
     <input name="search_StartDate" type="text" id="search_StartDate" class="Wdate" value="" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'search_EndDate\',{d:-1})}',readOnly:true})" size="15"  width="150px"/>
      -
	  <input name="search_EndDate" id="search_EndDate" type="text" class="Wdate" value="" onclick="WdatePicker({minDate:'#F{$dp.$D(\'search_StartDate\',{d:1})}',readOnly:true})" size="15" width="150px"/>
                <input type="button" name="Submit" value="搜索" onclick="search()" class="button2"></td>
            </tr>
          </table>
		</form>
	<% 
		int listsize = 0;
		if(list!=null && list.size()>0){
			listsize = list.size();
	%>
		</td>
          <table width="100%" height="30" border="0" bgcolor="#eddfea"  cellspacing="0" cellpadding="2" >
            <tr>
			  <td width="23%" align="left">商品名称</td>
              <td width="26%" align="left">评价概述</td>
			  <td width="22%" align="left">评价时间</td>
              <td width="17%" align="left">评价星级</td>
              <td width="12%" align="center">查看回复</td>
            </tr>
          </table>
          <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_list">


		<% 
			
				for(int i=0;i<list.size();i++){
					Hashtable map = (Hashtable)list.get(i);
					String info_id="",goods_id="",com_type="",content="",in_date="",a_user_id="",info_level="0",up_num="",down_num="",reply_content="",reply_date="",reply_user_id="",cust_name="";
					if(map.get("info_id")!=null) info_id = map.get("info_id").toString();
					int levels = 0;	
					if(map.get("goods_id")!=null) {
							goods_id = map.get("goods_id").toString();
							cust_name = custInfo.getGoodsNameById(goods_id);
					}
					if(map.get("com_type")!=null) com_type = map.get("com_type").toString();
					if(map.get("content")!=null) {
						content = map.get("content").toString();
						
						if(content.length() >= 20){
							content = content.substring(0,19) + "...";
						} 
					}
					if(map.get("in_date")!=null) in_date = map.get("in_date").toString();
					if(in_date.length()>19)in_date=in_date.substring(0,19);
					if(map.get("user_id")!=null) a_user_id = map.get("user_id").toString();
					if(map.get("info_level")!=null) {
						info_level = map.get("info_level").toString();
					}
					if(map.get("up_num")!=null) up_num = map.get("up_num").toString();
					if(map.get("down_num")!=null) down_num = map.get("down_num").toString();
					if(map.get("reply_content")!=null) reply_content = map.get("reply_content").toString();
					if(map.get("reply_date")!=null) reply_date = map.get("reply_date").toString();
					if(reply_date.length()>19)reply_date=reply_date.substring(0,19);
					if(map.get("reply_user_id")!=null) reply_user_id = map.get("reply_user_id").toString();
	
		  %>

            <tr>
    
              <td width="23%" height="80" align="left">
			  <%=cust_name%>
			  </td>
              <td width="26%" align="left">
			  <%=content%>
			  </td>
              <td width="22%" align="left">
			 <%=in_date%>
			  </td>
              <td width="17%" align="left">
				<%
					int info_l_int = 0;
					if(!info_level.trim().equals("")){
						info_l_int = Integer.parseInt(info_level);
					}
					for(int k=0;k<info_l_int;k++){
				%>
					<img src="/program/member/goodscomment/qy_xx1.jpg" border="0" />
				<%
					}
				%>
			  </td>	
			  
              <td width="12%" align="center">
				<a href="view.jsp?menu_id=<%=menu_id%>&info_id=<%=info_id%>"><img src="/program/images/magnifier.png" border="0"></a>
			  </td>
            </tr>
		  <%
		  		}
		  %>


          </table>


          
	<%
		 }
	%>
		  </td>
      </tr>
    </table>

	<table width="100%" border="0" cellpadding="0" cellspacing="0" >
		<tr>
		  <td width="4%" height="35" align="center">
		  <%=pageString %>
		  </td>
		</tr>
	  </table>
   
  </div>